<template>
    <div id="main">
        <nav>
            <span class="fa fa-angle-left" @touchstart="back($event)"></span>
            <span>设置</span>
            <span class="fa fa-ellipsis-h" @touchstart="btn"></span>
        </nav>
        <div id="hide" v-show="show" @touchstart="show=!show">
            <span class="fa fa-caret-up"></span>
            <div id="hide-bottom">
                <router-link to="/second/Message">
                    <div class="one">
                        <span class="fa fa-commenting-o"></span>
                        <span>消息</span>
                    </div>
                </router-link>
                <router-link to="/">
                    <div class="two">
                        <span class="fa fa-home"></span>
                        <span>首页</span>
                    </div>
                </router-link>
            </div>
        </div>
        <div id="box">
            <div class="item"><span>账号设置</span></div>
            <router-link to="/second/User/Online/Upload">
                <div id="box-small">
                    <div class="left">
                        <img :src="avatar?avatar:'/static/timgss.jpg'">
                        <span>{{username}}</span>
                    </div>
                    <div class="right">
                        <span>编辑个人资料</span>
                        <span class="fa fa-angle-right"></span>
                    </div>
                </div>
            </router-link>
            <div class="item-i"><span>修改密码</span><span class="fa fa-angle-right"></span></div>
            <div class="item-i"><span>绑定号码</span><span class="fa fa-angle-right"></span></div>
            <div class="item-i"><span>地址管理</span><span class="fa fa-angle-right"></span></div>
            <div class="item-i"><span>已屏蔽的人</span><span class="fa fa-angle-right"></span></div>
            <div class="item-i"><span>邀请好友</span><span class="fa fa-angle-right"></span></div>
            <div class="item-one"><span>系统设置</span></div>
            <div class="item-i"><span>消息推送</span><span class="fa fa-angle-right"></span></div>
            <div class="item-i"><span>短信提醒</span><span class="fa fa-angle-right"></span></div>
            <div class="item-i"><span>图片显示</span><span class="fa fa-angle-right"></span></div>
            <div class="item-i"><span>清理缓存</span><span class="fa fa-angle-right"></span></div>
            <div class="item-one"><span>支持</span></div>
            <div class="item-i"><span>给猎趣好评</span><span class="fa fa-angle-right"></span></div>
            <div class="item-i"><span>意见反馈</span><span class="fa fa-angle-right"></span></div>
            <div class="item-i"><span>关于猎趣</span><span class="fa fa-angle-right"></span></div>
        </div>
        <button @touchstart="exit">退出</button>
    </div>
</template>

<script>
import {mapState,mapGetters} from 'vuex'
export default{
    data:function(){
        return{
            show:false
        }
    },
    components:{
        mapState,
        mapGetters
    },
    methods:{
        btn:function(){
            this.show = !this.show;
        },
        exit:function(){
            this.$store.dispatch("requestExit")
            .then(res=>{
                location.href = "#/"
            })
        },
        back:function(e){
            e.preventDefault();
            history.back();
        },
        hide:function(){
            this.show =false;
        }
    },
    mounted:function(){
        this.$store.dispatch("requestUserInfo");
        this.$store.commit("setUsername");
        this.$store.commit("setAvatar");
    },
    computed:{
        ...mapState([
            "username",
            "avatar"
        ])
    }
}
</script>

<style scoped>
    #main{
        background-color: white;
    }
    nav{
        height: 35px;
        line-height: 35px;
        border-bottom: 1px solid #bbb;
        padding: 0 10px;
        display: flex;
        justify-content: space-between;
        z-index: 100;
    }
    nav span:nth-of-type(1){
        font-size: 23px;
        margin-top: 5px;
    }
    nav span:nth-of-type(3){
        font-size: 22px;
        margin-top: 8px;
    }
    #hide{
        position: absolute;
        right: 5px;
        top: 8px;
    }
    .fa-caret-up{
        font-size: 25px;
        position: relative;
        top: 9px;
        left: 79px;
        color: rgba(0,0,0,0.75);
    }
    #hide-bottom{
        width: 100px;
        height: 70px;
        border: 1px solid #666;
        color: white;
        background-color: rgba(0,0,0,0.75);
    }
    .one{
        border-bottom: 1px solid #999;
    }
    .two,.one{
        height: 35px;
        line-height: 35px; 
        padding-left: 8px;
    }
    .one span:nth-of-type(2){
        margin-left: 6px;
        font-size: 14px;
    }
    .two span:nth-of-type(2){
        margin-left: 6px;
        font-size: 14px;
    }
    a{
        color: white;
        text-decoration: none;
    }
    #box{
        padding-left: 10px;
    }
    .item{
        height: 40px;
        line-height: 40px;
        border-bottom: 1px solid #ccc;
        font-size: 15px;
        font-family: 微软雅黑;
    }
    #box-small{
        display: flex;
        justify-content: space-between;
        padding-right: 4vw;
        height: 10vh;
        line-height: 10vh;
        border-bottom: 1px solid #ccc;
    }
    .left{
        position: relative;
        width: 32vw;
    }
    .left img{
        width: 14vw;
        height: 8vh;
        border-radius: 50%;
        margin-top: 5px;
    }
    .left span{
        position: absolute;
        color: black;
        margin-left: 8px;
    }
    .right span{
        font-size: 15px;
        color: #777;
        margin-left: 6px;
    }
    .item-i{
        display: flex;
        justify-content: space-between;
        padding-right: 4vw;
        height: 35px;
        line-height: 35px;
        border-bottom: 1px solid #ccc;
        font-size: 15px;
    }
    .item-i span:nth-of-type(2){
        color: #777;
        margin-top: 10px;
    }
    .item-one{
        padding-right: 4vw;
        height: 35px;
        line-height: 35px;
        border-bottom: 1px solid #ccc;
        font-size: 13px;
    }
    button{
        margin-top: 10px;
        width: 100%;
        height:45px; 
        color: white;
        background-color: orangered;
        border: none;
        font-size: 18px;
    }
</style>